//发送短信 sms
let smsUrl = '/sms';
//用户注册
let userRegisterUrl = '/register'
// 获取首页信息
let getIndexUrl = '/index'
// 获取健康栏目
let healthItemUrl = '/healthItem'
// 历史数据
let hisDataUrl = '/measure/history'
// 学校列表
let schoolListUrl = '/school'
//教室列表
let classListUrl = '/school/class'
//更改学校
let changeSchoolUrl = '/baby/school'
//获取区域
let regionUrl = '/region'
//获取学校
let schoolUrl = '/school/byCode'
//绑定宝宝
let babyBindUrl = '/school/student'
//更新角色
let updateRoleUrl = '/user/role'
//更新性别
let updateSexUrl = '/baby/sex'
// 提交老师审核信息
let checkTeacherUrl = '/user/teacher'
// 提交校长审核信息
let checkPrincipalUrl = '/user'

// 获取校长班级
let getPrincipalClassUrl = '/user/principal'

// 获取班级学生
let getClassBabyUrl = '/class/baby'
// 获取老师审核list
let getTeacherCheckListUrl = '/school/teacher/check'

// 获取报告
let getReportUrl = '/baby/finalReport'
// 更改用户手机号
let changeUserPhoneUrl = '/user/phone'



const install = (Vue, vm) => {
  //发送短信 sms
  let smsApi = (params) => vm.$u.post(smsUrl, params);
  //用户注册
  let userRegisterApi = (params) => vm.$u.post(userRegisterUrl, params);
  // 获取首页信息
  let getIndexApi = (params) => vm.$u.get(getIndexUrl, params);
  // 获取健康栏目
  let healthItemApi = (params) => vm.$u.get(healthItemUrl, params);
  // 历史数据
  let hisDataApi = (params) => vm.$u.get(hisDataUrl, params);
  // 学校列表
  let schoolListApi = (params) => vm.$u.get(schoolListUrl, params);
  // 教室列表
  let classListApi = (params) => vm.$u.get(classListUrl, params);
  // 更改学校
  let changeSchoolApi = (params) => vm.$u.put(changeSchoolUrl, params);
  //获取区域
  let regionApi = (params) => vm.$u.get(regionUrl, params);
  //获取学校
  let schoolApi = (params) => vm.$u.get(schoolUrl, params);
  //绑定宝宝
  let babyBindApi = (params) => vm.$u.post(babyBindUrl, params);
  //更新角色
  let updateRoleApi = (params) => vm.$u.put(updateRoleUrl, params);
  //更新性别
  let updateSexApi = (params) => vm.$u.put(updateSexUrl, params);
  // 提交老师审核信息
  let checkTeacherApi = (params) => vm.$u.put(checkTeacherUrl, params);
  // 提交校长审核信息
  let checkPrincipalApi = (params) => vm.$u.put(checkPrincipalUrl, params);
  // 获取校长班级信息
  let getPrincipalClassApi = (params) => vm.$u.get(getPrincipalClassUrl, params);


  // 获取班级信息
  let getClassBabyApi = (params) => vm.$u.get(getClassBabyUrl, params);



  // 获取老师审核list
  let getTeacherCheckListApi = (params) => vm.$u.get(getTeacherCheckListUrl, params);

  // 更新审核状态
  let reFreshCheckApi = (params) => vm.$u.put(getTeacherCheckListUrl, params);


  //  获取老师信息
  let getTeacherApi = (params) => vm.$u.get(checkTeacherUrl, params);

  // 获取报告
  let getReportApi = (params) => vm.$u.get(getReportUrl, params);

// 更改用户手机号
  let changeUserPhoneApi = (params) => vm.$u.put(changeUserPhoneUrl, params);
  // 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
  vm.$u.api = {
    smsApi,
    userRegisterApi,
    getIndexApi,
    healthItemApi,
    hisDataApi,
    schoolListApi,
    classListApi,
    changeSchoolApi,
    regionApi,
    schoolApi,
    babyBindApi,
    updateRoleApi,
    updateSexApi,
    checkTeacherApi,
    checkPrincipalApi,
    getPrincipalClassApi,
    getClassBabyApi,
    getTeacherCheckListApi,
    reFreshCheckApi,
    getTeacherApi,
    getReportApi,
    changeUserPhoneApi
  };
}

export default {
  install
}